import {Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {URL} from '../config'
import {HttpClient, HttpHeaders} from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class LoginAndregisterService {
  url=URL;
  simulteLogin(){
    return "simulate login"
  }
  //注册
  submitRegister(email,passWd):Observable<any>{
    return this.http.get(this.url+'register', {
      params: {
        username: email,
        password: passWd
      },
      withCredentials: true
    })
  }
  //登录
  submitLogin(email,password):Observable<any>{
    return this.http.get(this.url+'login', {
      params: {
        username: email,
        password: password
      },
      withCredentials: true,

    })
  }
  constructor( private http: HttpClient) { }
}
